class Solution {
public:
    bool canConstruct(string ransomNote, string magazine) {
        int ran[26],mag[26];
        fill(ran,ran+26,0);
        fill(mag,mag+26,0);
        for(int i=0;i<ransomNote.length();i++){ran[ransomNote[i]-'a']++;}
        for(int i=0;i<magazine.length();i++){mag[magazine[i]-'a']++;}
        for(int i=0;i<26;i++){
            if(mag[i]<ran[i]){return false;}
        }
        return true;
    }
};